package demo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class TestMain {

    public static void test1()
    {
        //使用p:命名空间简化配置
        ApplicationContext ctx=new ClassPathXmlApplicationContext("bean_lec04.xml");        
        Person p =  ctx.getBean("cutter1", Person.class);    
        p.useAxe();
    }
    public static void test2()
    {
        //使用C:命名空间简化配置
        ApplicationContext ctx=new ClassPathXmlApplicationContext("bean_lec04.xml");        
        Person p =  ctx.getBean("cutter2", Person.class);    
        p.useAxe();

        p =  ctx.getBean("cutter3", Person.class);    
        p.useAxe();

    }

    public static void test3()
    {
        //使用util:命名空间简化配置
        ApplicationContext ctx=new ClassPathXmlApplicationContext("bean_lec04.xml");
        Person p =  ctx.getBean("cutter4", Person.class);    
        p.useAxe();
        System.out.println(ctx.getBean("confTest"));
    }

    public static void main(String[] args)
    {
        test1();
        test2();
        test3();
    }
}
